/*
 * HapMatrices.h
 *
 *  Created on: Apr 12, 2012
 *      Author: pickrell
 */

#ifndef HAPMATRICES_H_
#define HAPMATRICES_H_

#include "HapMatrix.h"
using namespace std;

class HapMatrices{
public:
	HapMatrices(string, string, string, string);
	vector<HapMatrix> d;
	void read_hapmatrices(string);
	void get_ind2keep(string, string, string);
	set<string> ind2keep;
	map<string, string> ind2pop;
	void print();
	vector<string> allmixinds;
	set<string> mixinds1;
	set<string> mixinds2;
	set<string> sourceinds;
	int set_weights();
	void print_d();
	vector<pair<vector<float>, vector<float> > > bin_d(double);
	vector<vector<float> > bin_d_lowmem(double);
	vector<vector<float> > bin_d_freq_lowmem(double);
	vector<vector<float> > bin_d_freq_cor_lowmem(double, vector<pair<float, float> >);

	double get_cor(vector<float>*, vector<float>*);
	pair<double, double> get_regress(vector<float>*, vector<float>*);
	pair<double, double> get_regress_lowmem(vector<float>);
	vector<pair<double, double> > rolloff(double);
	vector<pair<double, double> > rolloff_lowmem(double);
	vector<pair<double, double> > rolloff_freq_lowmem(double);
	vector<pair<double, double> > rolloff_freq_cor_lowmem(double);
	pair<double, double> fitexp(vector<pair<double, double> >, int);
	void roll_and_fit(string, double, int);
	void roll_print(string, double);
	void roll_print_lowmem(string, double);
	void roll_print_freq_lowmem(string, double);
	void roll_print_freq_cor_lowmem(string, double);
	double MAXDIST;
	int nsnp;

	double cor_mix, cor_source, mean_nind_source, mean_nind_mix, hzy_source, hzy_mix;
	double f2, f2_uncor;
	double beta_cor;
};



#endif /* HAPMATRICES_H_ */
